package com.syuntax.domain;

import com.syuntax.util.DataUtils;

import java.math.BigDecimal;
import java.sql.Timestamp;

public class IndexValue{
    long value_id;
    long index_id;
    long date_info_id;
    BigDecimal value;
    Timestamp create_date;

    public IndexValue() {
    }

    public IndexValue(long value_id, long index_id, long date_info_id, BigDecimal value, Timestamp create_date) {
        this.value_id = value_id;
        this.index_id = index_id;
        this.date_info_id = date_info_id;
        this.value = value;
        this.create_date = create_date;
    }

    public int compareTo(IndexValue o2){
        long o1_level_id = DataUtils.queryIndexById(getIndex_id()).getIndex_level_id();
        long o2_level_id = DataUtils.queryIndexById(o2.getIndex_id()).getIndex_level_id();
        int o1_level = Integer.valueOf(DataUtils.queryTypeById(o1_level_id).getType_code());
        int o2_level = Integer.valueOf(DataUtils.queryTypeById(o2_level_id).getType_code());
        return o1_level-o2_level;
    }

    public long getValue_id() {
        return value_id;
    }

    public void setValue_id(long value_id) {
        this.value_id = value_id;
    }

    public long getIndex_id() {
        return index_id;
    }

    public void setIndex_id(long index_id) {
        this.index_id = index_id;
    }

    public long getDate_info_id() {
        return date_info_id;
    }

    public void setDate_info_id(long date_info_id) {
        this.date_info_id = date_info_id;
    }

    public BigDecimal getValue() {
        return value;
    }

    public void setValue(BigDecimal value) {
        this.value = value;
    }

    public Timestamp getCreate_date() {
        return create_date;
    }

    public void setCreate_date(Timestamp create_date) {
        this.create_date = create_date;
    }

    @Override
    public String toString() {
        String str = "[ 主键=" + getValue_id() + ", 指标主键=" + getIndex_id() + ", 日期主键=" + getDate_info_id() + ", 结果=" + getValue() + ", 创建日期=" + getCreate_date() + "]";
        return str;
    }
}